@extends('layouts.back_stage')
@section('content')
    <style>
        .address {
            border-color: #cfdadd;
            border-radius: 2px;
            width: 25%;
            height: 30px;
            padding: 6px 10px;
            font-size: 12px;
            line-height: 1.42857143;
            margin-right:10px;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #cfdadd;
            box-shadow: none;
            -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
        }
        table,th,td{text-align: center}
        h3{display:inline-block;}
    </style>
    <div class="container">
        <div style="padding:20px 0;">
            <h3>消息列表</h3>
            <div style="float:right;">
                <span>消息提醒：</span>
                <a style="margin-right:5px;cursor:default;" href="JavaScript:;">全部消息({{$had_read}})</a>
                <a style="cursor:default;" href="JavaScript:;">未读消息({{$no_read}})</a>
            </div>
        </div>
        <div class="pull-left" style="width: 100%;margin-bottom: 20px">
            <form action="/work-order/msg-lists"  method="get" role="form" style="display: inline-block;margin-right: 10px">
                <label>消息类型：</label>
                <select name="status" class="address" style="width: 150px">

                    @if($req->status==-1)
                        <option value="-1">未读</option>
                    @elseif($req->status==1)
                        <option value="1">已读</option>
                    @endif
                    <option value="">全部</option>
                    <option value="-1">未读</option>
                    <option value="1">已读</option>
                </select>
                <button type="submit" class="btn btn-info" style="margin-bottom:4px;">搜索</button>
            </form>
        </div>
        <table class="table table-hover data-table">
            <thead>
            <tr>
                <th class="text-center">提交人</th>
                <th class="text-center">消息内容</th>
                <th class="text-center">状态</th>
                <th class="text-center">发生时间</th>
                <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            @if(count($infos)>0)
                @foreach ($infos as $k => $v)
                    <tr>
                        <td>{{$v->submitter_name}}</td>
                        <td>{{$v->content}}</td>
                        @if($v->status==1)
                            <td style="color:#999;">已读</td>
                        @else
                            <td>未读</td>
                        @endif
                        <td>{{$v->updated_at or $v->created_at }}</td>
                        <td><a href="/work-order/work-order-chat?id={{$v->pid}}">详情</a></td>
                    </tr>
                @endforeach
           @endif
            </tbody>
        </table>
        <div style="float: right">{{$infos->appends(['status'=>$req->status])->links()}}</div>
    </div>
    <script>
        window.onload=function(){
            var url = window.location.href;
            if(url.indexOf("tn=1") >= 0 ) {
                $(".order_li").addClass('active').siblings().removeClass('active');
                $(".order_li").children('.nav-second-level').addClass('in').parent().siblings().children('.nav-second-level').removeClass('in');
            }
            var num=$(".order_li.item-li").index();
            sessionStorage.setItem('Number',num);
        }
    </script>
@endsection